<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no" />
    @include('public.h5_head')
    <title>添加商品</title>
    <script src="{{ env('CDN_DOMAIN_NAME') }}/js/commonjs/rem.js"></script>
    <link href="{{env('CDN_DOMAIN_NAME')}}/css/font-awesome.min.css" rel="stylesheet">
    <link rel="stylesheet" type="text/css" href="{{ env('CDN_DOMAIN_NAME') }}/css/commoncss/common.css"/>
    <link rel="stylesheet" type="text/css" href="{{ env('CDN_DOMAIN_NAME') }}/css/add.css?v=1.0.5"/>
    <link rel="stylesheet" type="text/css" href="{{ env('CDN_DOMAIN_NAME') }}/webuploader/css/webuploader.css">
    <link rel="stylesheet" type="text/css" href="{{ env('CDN_DOMAIN_NAME') }}/css/commoncss/mobiscroll.core-2.5.2.css"  />
    <link rel="stylesheet" type="text/css" href="{{ env('CDN_DOMAIN_NAME') }}/css/commoncss/mobiscroll.android-ics-2.5.2.css"  />

    <script src="{{ env('CDN_DOMAIN_NAME') }}/js/app.js"></script>
    <script src="{{ env('CDN_DOMAIN_NAME') }}/js/commonjs/common.js?v=1.0.1"></script>
    <!--引入JS-->
    <script type="text/javascript" src="{{ env('CDN_DOMAIN_NAME') }}/webuploader/dist/webuploader.js"></script>
    <script src="{{ env('CDN_DOMAIN_NAME') }}/js/commonjs/mobiscroll.core-2.5.2.js"></script>
    <script src="{{ env('CDN_DOMAIN_NAME') }}/js/commonjs/mobiscroll.datetime-2.5.1.js"></script>
    <script src="{{ env('CDN_DOMAIN_NAME') }}/js/commonjs/mobiscroll.android-ics-2.5.2.js"></script>
</head>
<style>
    .delete-img{cursor: pointer;}
    .bus-upload-img{cursor: pointer;}
    .delete-video{cursor: pointer;position: absolute;top: 0;left: 0;width: 100%;height: 100%;z-index: 1000;}
    .video-upload-img{cursor: pointer;}
    .webuploader-pick{display:block;padding:0;color:#383838;background: #fff;text-align: start;cursor:pointer;}
    .preDiv{width: 33%;float: right;height: 100%;font-size:0.597rem;}
    .preDiv i{font-size:0.8rem;margin-right:0.3rem;float: left;margin-top: 0.39rem;}
    .preDiv .fa-check-circle{color:#1aad1a;}
    .preDiv .fa-circle-thin{color:#383838;}
    .preDiv b{font-weight:normal;}
</style>
<body>
<div id="add_item">
    <div class="wrap">
        <div class="main_datum">
            <p class="main_headline">请填写基本资料</p>
            <ul class="main_news">
                <li class="news_li">
                    <span><b>*</b>品牌名称</span>
                    <div class="chose_brand">
                    <select name="" class="news_select">
                        @if($pro->brand)
                            <option value="{{ $pro->brand }}"  >{{ $new_brands[$pro->brand] }}</option>
                            @else
                            <option value="">请选择您的品牌名称</option>
                        @endif
                        @foreach($new_brands as $k=>$v)
                            <option value="{{ $k }}"  >{{ $v }}</option>
                        @endforeach
                    </select>
                    </div>
                </li>
                <li class="news_li">
					<span><b>*</b>商品款号</span>
					<select name="" class="select_id girard">
                        @if($pro->girard == null)
						<option value="">请选择您的商品款号</option>
                        @else
                            <option value="{{ $pro->girard }}">{{ $pro->girard }}</option>
                        @endif
                        @foreach($_girards as $k => $v)
                                <option value="{{ $v }}">{{ $v }}</option>
                            @endforeach
					</select>
				</li>
                <li class="news_li">
                    @if($pro->pre_sale == 1)
                        <div class="preDiv presell" abc="1"><i class="fa fa-check-circle"></i><b>预售</b></div>
                        <div class="preDiv" abc="0"><i class="fa fa-circle-thin"></i><b>普通</b></div>
                    @else
                        <div class="preDiv" abc="1"><i class="fa fa-circle-thin"></i><b>预售</b></div>
                        <div class="preDiv presell" abc="0"><i class="fa fa-check-circle"></i><b>普通</b></div>
                    @endif
                </li>
                <li class="news_li yuZuo" @if($pro->pre_sale == 1)  @else style="display:none;" @endif>
                    <span><b>&nbsp;</b>预售起做量</span>
                    <input type="text" maxlength="11" placeholder="预售起做量" class="min_nums inp_news" value="{{ $pro->min_nums }}"/>
                </li>
                <li class="news_li">
                    <span><b>*</b>一手件数</span>
                    <select name="" class="select_id hand">
                        <option value="{{ $pro->count_nums }}">{{ $pro->count_nums }}</option>
                        <option value="1">1</option>
                        <option value="2">2</option>
                        <option value="3">3</option>
                        <option value="4">4</option>
                        <option value="5">5</option>
                        <option value="6">6</option>
                        <option value="7">7</option>
                        <option value="8">8</option>
                        <option value="9">9</option>
                        <option value="10">10</option>
                        <option value="11">11</option>
                        <option value="12">12</option>
                    </select>
                </li>
                <li class="news_li">
                    <span><b>*</b>是否控区</span>
                    <select name="" class="select_id area">
                        @if($pro->has_area)
                            <option value="1">是</option>
                            <option value="0">否</option>
                        @else
                            <option value="0">否</option>
                            <option value="1">是</option>
                        @endif
                    </select>
                </li>
                {{--<li class="news_li">--}}
                    {{--<span><b>*</b>选择大区</span>--}}
                    {{--<select class="select_id region">--}}
                        {{--@if(isset($pro->area_id) && $pro->area_id)--}}
                            {{--<option value="{{ $pro->area_id }}">{{ $company_areas[$pro->area_id] }}</option>--}}
                        {{--@else--}}
                            {{--<option value="">请选择</option>--}}
                        {{--@endif--}}
                        {{--@foreach($company_areas as $k=>$v)--}}
                            {{--<option value="{{ $k }}">{{ $v }}</option>--}}
                        {{--@endforeach--}}
                    {{--</select>--}}
                {{--</li>--}}
                <li class="news_li">
                    <span><b>*</b>选择公司</span>
                    <select class="select_id team">
                        @if(isset($pro->company_id) && $pro->company_id)
                            <option value="{{ $pro->company_id }}">{{ $companys[$pro->company_id] }}</option>
                        @else
                            <option value="">请选择</option>
                        @endif
                        @foreach($companys as $k=>$v)
                        <option value="{{ $k }}">{{ $v }}</option>
                        @endforeach
                    </select>
                </li>
                <li class="news_li">
                    <span><b>*</b>商品名称</span>
                    <input type="text" maxlength="30" placeholder="商品名称(最多30个字)" class="inp_name inp_news" value="{{ $pro->title }}"/>
                </li>
                <li class="news_li">
                    <span><b>*</b>商品单价</span>
                    <input type="text" maxlength="11" placeholder="指导单价" class="inp_price inp_news inp_money" value="{{ $pro->price/$pro->count_nums }}"/>
                </li>
                <li class="news_li">
                    <span><b>*</b>成本价格</span>
                    <input type="text" maxlength="11" placeholder="成本价格" class="inp_news inp_cost" value="{{ $pro->cost_price }}"/>
                </li>
                <li class="news_li">
                    <span><b>*</b>总库存</span>
                    <input type="tel" maxlength="4" placeholder="总库存" class="inp_news total_stock" value="{{ $pro->total_stock }}"/>
                </li>
                <li class="news_li">
                    <span><b>*</b>商品邮费</span>
                    <input type="text" maxlength="6" placeholder="1手邮费" class="inp_money inp_post1" value="{{ $pro->pro_postage[0] }}"/>
                    <input type="text" maxlength="6" placeholder="2手邮费" class="inp_money inp_post2" value="{{ $pro->pro_postage[1] }}"/>
                </li>
                <li class="news_li">
                    <span><b>*</b>预发货时间</span>
                    <input type="text" id="data" readonly placeholder="时间" class="inp_news inp_time" value="{{ $pro->estimate_send_at }}"/>
                </li>
                {{--<li class="news_li">--}}
                    {{--<div class="main_pic main_com"><b style="color:#fff;">*</b>添加商品视频<div class="iconfont icon-jiantouyou arrows"></div></div>--}}
                    {{--<ol class="main_video">--}}
                        {{--@if(isset($video))--}}
                        {{--<li class="li_video">--}}
                            {{--<video src="{{ env('CDN_DOMAIN_NAME') }}/upload_video/{{$video->produc_val}}" id="{{ $video->id }}" style="background:#000;"></video>--}}
                            {{--<div class="del_mask delete-video"></div>--}}
                        {{--</li>--}}
                        {{--@else--}}
                        {{--<div class="video_jia" id="video-upload-img"></div>--}}
                        {{--@endif--}}
                    {{--</ol>--}}
                {{--</li>--}}
                <li class="news_li picVideo">
                    <div class="main_pic main_com"><b style="color:#fff;">*</b>添加商品图片<div class="iconfont icon-jiantouyou arrows"></div></div>
                    @if(count($faces) > 0)
                        <ol class="main_img">
                            @foreach($faces as $face)
                                <li class="li_img">
                                    <img src="{{ env('CDN_DOMAIN_NAME') }}/upload/{{$face->produc_val}}" class="delete-img" id="{{ $face->id }}"  alt="">
                                </li>
                            @endforeach
                                <div class="li_jia" id="bus-upload-img"></div>
                        </ol>
                        @else
                    <ol class="main_img" >
                        <div class="li_jia" id="bus-upload-img"></div>
                    </ol>
                    @endif

                </li>
                <li class="news_li infTit">
                    <div class="main_perfect main_com">商品描述</div>
                </li>
                <li class="news_li desInfos">
                    <div class="border_t">
                        <textarea class="describe" maxlength="200" rows="" cols="" placeholder="请输入描述...(最多200字)">{{ $pro->describe }}</textarea>
                    </div>
                </li>
            </ul>
            <div class="imgdiv"></div>
            <input type="hidden" class="produc_id" value="{{ $pid }}">
        </div>
    </div>
    @include('public.delete_tips')
    <div class="overadd"><a href="javascript:;" id="add_save"  class="over">下一步</a></div>
    <meta name="csrf_token" id="token" content="{{ csrf_token() }}">
    <div class="user_tips" style="display: none;"></div>
</div>
</body>
<script>
    var domain = "{{ env('UPLOAD_IMG_DOMAIN') }}";
</script>
<script src="{{ env('CDN_DOMAIN_NAME') }}/js/public.js"></script>
{{--<script src="{{ env('CDN_DOMAIN_NAME') }}/js/video.js"></script>--}}
<script src="{{ env('CDN_DOMAIN_NAME') }}/js/add.js?v=1.1.0"></script>
<script>
    is_weixn('.overadd');
    /*iphoneX*/
    var str= navigator.userAgent.toLowerCase();
    var ver=str.match(/cpu iphone os (.*?) like mac os/);
    if(ver && $(window).width() === 375 && $(window).height() === 724 && window.devicePixelRatio === 3){
        $(".overadd").css("height","3.499rem");
        $(".wrap").css("bottom","3.499rem");
        $(".dwbg").css("top","490px");
    }
    $(".total_stock").bind("input","onpropertychange",function(){
        $(this).val($(this).val().replace(/[^\d]/g,""));
    });
    $(".inp_money").bind("input","onpropertychange",function(){
        $(this).val($(this).val().replace(/[^\d.]/g,""));
        $(this).val($(this).val().replace(/\.{2,}/g,"."));
        $(this).val($(this).val().replace(/^\./g,""));
        $(this).val($(this).val().replace(".","$#$").replace(/\./g,"").replace("$#$","."));
        $(this).val($(this).val().replace(/^(\-)*(\d+)\.(\d\d).*$/,'$1$2.$3'));
        if($(this).val().indexOf(".")< 0 && $(this).val() !=""){
            $(this).val(parseFloat($(this).val()));
        }
    });
    $(".inp_cost").bind("input","onpropertychange",function(){
        $(this).val($(this).val().replace(/[^\d.]/g,""));
        $(this).val($(this).val().replace(/\.{2,}/g,"."));
        $(this).val($(this).val().replace(/^\./g,""));
        $(this).val($(this).val().replace(".","$#$").replace(/\./g,"").replace("$#$","."));
        $(this).val($(this).val().replace(/^(\-)*(\d+)\.(\d\d).*$/,'$1$2.$3'));
        if($(this).val().indexOf(".")< 0 && $(this).val() !=""){
            $(this).val(parseFloat($(this).val()));
        }
    });
    $(".describe").bind("input","onpropertychange",function(){
        $(this).val($(this).val().replace(/[^\a-\z\A-\Z0-9\u4E00-\u9FA5，。、；！【】,.;!-]/g,''));//只能输入中文，英文，数字
    });

    /*选择预售*/
    $(".preDiv").click(function(){
        if($(this).attr("abc")==0){
            $(".yuZuo").hide();
        }else if($(this).attr("abc")==1){
            $(".yuZuo").show();
        }
        $(this).addClass("presell").siblings(".preDiv").removeClass("presell");
        $(this).children(".fa").remove();
        $(this).prepend("<i class='fa fa-check-circle'></i>");
        $(this).siblings(".preDiv").children(".fa").remove();
        $(this).siblings(".preDiv").prepend("<i class='fa fa-circle-thin'></i>");
    });
/*预发布时间*/
    var now = new Date();
    var currYear1 = now.getFullYear();
    var currMonth = now.getMonth();
    var currDay = now.getDate();
    $(function() {
        var currYear = (new Date()).getFullYear();
        var opt = {};
        opt.date = {preset:'date',stepMinute:1};
        opt.default = {
            theme: 'android-ics light', //皮肤样式
            display: 'bottom', //显示方式
            mode: 'scroller', //日期选择模式
            lang: 'zh',
            startYear: currYear, //开始年份currYear - 10,
            endYear: currYear+1,//结束年份currYear + 10
            minDate: new Date(currYear1,+currMonth,+currDay+1),
            setText: '确定',
            cancelText: '取消',
            /*清楚默认样式，更改中文模式*/
            dateFormat: 'yyyy/mm/dd',
            dateOrder: 'yymmdd',
            dayNames: ['周日', '周一;', '周二;', '周三', '周四', '周五', '周六'],
            dayNamesShort: ['日', '一', '二', '三', '四', '五', '六'],
            dayText: '日',
            hourText: '时',
            minuteText: '分',
            monthNames: ['一月', '二月', '三月', '四月', '五月', '六月', '七月', '八月', '九月', '十月', '十一月', '十二月'],
            monthNamesShort: ['1月', '2月', '3月', '4月', '5月', '6月', '7月', '8月', '9月', '10月', '11月', '12月'],
            monthText: '月',
            secText: '秒',
            timeFormat: 'HH:ii',
            timeWheels: 'HHii',
            yearText: '年'
        };
        var optDateTime = $.extend(opt['date'], opt['default']);//年月日型
        $(".inp_time").mobiscroll(optDateTime).date(optDateTime);
    });
    /*点击日期清除按钮，清空input框*/
    $(document).on('click','.dwb-n',function(){
        $(".inp_time").val("");
    });
</script>
</html>





